<?php
/**
 * Created by PhpStorm.
 * User: Jessewang
 * Date: 2017/5/13
 * Time: 上午2:43
 */

namespace App\Handler;

use Swoole;
use App\Libs\Log;
use App\Libs\TimApi;

class MsgHandle implements Swoole\IFace\EventHandler
{
    function trigger($type, $data)
    {
        //var_dump($data);
        if(!empty($data))
        {
            $timapi = new TimApi();
            $userid = $data['userid'];
            $destid = $data['destid'];
            $msgbody = $data['msgbody'];
           $ret = $timapi->sendMsg($userid,"24",$msgbody);
            Log::info($userid."|".$destid."|".$ret['ActionStatus']);
        }
    }
}